package com.sdk.service.impl;

import com.coment.dto.LiveData;
import com.coment.dto.LiveData.ApiType;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class SdkService {
    @Value("${spring.profiles.active}")
    public String env;
    @Resource
    private DYServiceImpl dYService;

    @Async
    public void synchronizeAPIMessages(String apiTypeValue, SyncRoundStatus syncRoundStatus) {
        if (this.env.equals("online")) {
            ApiType apiType = ApiType.fromValue(apiTypeValue);
            switch (apiType) {
                case douyin:
                    this.dYService.syncRoundStatus(syncRoundStatus.roundId, syncRoundStatus.roomId, syncRoundStatus.anchorOpenId, syncRoundStatus.time, syncRoundStatus.camp, syncRoundStatus.status);
                case kuaiShou:
            }
        }

    }

    /**
     * 同步回合状态的记录类
     *
     * @param roundId      回合ID
     * @param roomId       房间ID
     * @param anchorOpenId 主播开放ID
     * @param time         时间戳
     * @param camp         阵营信息
     * @param status       状态值
     */
    public record SyncRoundStatus(
            int roundId,
            String roomId,
            String anchorOpenId,
            long time,
            String camp,
            int status
    ) {
    }
}
